<?php

class Category extends AppModel {

    var $name = 'Category';
    #var $belongsTo = array('ContentType', 'Template');
    #var $hasMany = array('ContentImage', 'ContentDescription', 'ContentAttribute' => array('dependent' => true));
    #var $hasOne = array('ContentLink' => array('dependent' => true), 'ContentProduct' => array('dependent' => true), 'ContentPage' => array('dependent' => true), 'ContentCategory' => array('dependent' => true), 'ContentArticle' => array('dependent' => true), 'ContentNews' => array('dependent' => true));
    
    function loadAttrib($id) {
        $sql = "SELECT columnname,dataval FROM content_attributes WHERE content_id={$id}";
        $res = $this->query($sql);
        $dat = array();
        foreach ($res as $s) {
            $dat[$s['content_attributes']['columnname']] = $s['content_attributes']['dataval'];
        }
        asort($dat);
        return $dat;
    }
}